package com.qst.system.service.impl;

import com.qst.common.core.domain.entity.Provinces;
import com.qst.system.domain.Company;
import com.qst.system.domain.CompanyDetails;
import com.qst.system.domain.Province;
import com.qst.system.domain.vo.CompanyDetailsVo;
import com.qst.system.mapper.CompanyDetailsMapper;
import com.qst.system.mapper.CompanyMapper;
import com.qst.system.mapper.ProvincesMapper;
import com.qst.system.service.ICompanyDetailsService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class CompanyDetailsServiceImpl implements ICompanyDetailsService {

    @Autowired
    private CompanyDetailsMapper companyDetailsMapper;

    @Autowired
    private CompanyMapper companyMapper;

    @Autowired
    private ProvincesMapper provincesMapper;

    @Override
    public List<CompanyDetailsVo> selectCompanyDetailsList(CompanyDetailsVo companyDetailsVo) {
        List<CompanyDetailsVo> companyDetailsVos = companyDetailsMapper.selectCompanyDetailsList(companyDetailsVo);
        System.out.println(companyDetailsVos);
        return companyDetailsVos;
    }

    @Override
    public CompanyDetailsVo selectCompanyDetailsById(Long cId) {
        CompanyDetailsVo companyDetailsVo = companyDetailsMapper.selectCompanyDetailsById(cId);
        return companyDetailsVo;
    }

    @Override
    public int insertCompanyDetails(CompanyDetailsVo companyDetailsVo) {
        CompanyDetails companyDetails = new CompanyDetails();
        BeanUtils.copyProperties(companyDetailsVo, companyDetails);
        return companyDetailsMapper.insertCompanyDetails(companyDetails);
    }

    @Override
    public int updateCompanyDetails(CompanyDetailsVo companyDetailsVo) {
        return companyDetailsMapper.updateCompanyDetails(companyDetailsVo);
    }

    @Override
    public int deleteCompanyDetailsById(Long cId) {
        return companyDetailsMapper.deleteCompanyDetailsById(cId);
    }

    @Override
    public int deleteCompanyDetailsByIds(Long[] cIds) {
        return companyDetailsMapper.deleteCompanyDetailsByIds(cIds);
    }
}
